package com.mall.common.domain;

import javax.persistence.MappedSuperclass;

import org.apache.commons.lang.builder.CompareToBuilder;


@SuppressWarnings("rawtypes")
@MappedSuperclass
public abstract class PriorityEntity extends BaseEntity implements Comparable {

	private static final long serialVersionUID = 0x5332909338966bc3L;
	public static final String ORDER_PROPERTY_NAME = "priority";
	protected Integer priority;

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public int compareTo(PriorityEntity orderEntity) {
		return new CompareToBuilder().append(getPriority(), orderEntity.getPriority()).append(getId(), orderEntity.getId()).toComparison();
	}
	
	public int compareTo(Object obj) {
		return compareTo((PriorityEntity)obj);
	}
}
